﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using Robotlegs.Bender.Extensions.ViewManagement.API;
using Robotlegs.Bender.Extensions.Mediation.API;

public class ViewBase:MonoBehaviour,IView
{

    private Action<IView> _removeView;
    public event Action<IView> RemoveView
    {
        add
        {
            _removeView += value;
        }
        remove
        {
            _removeView -= value;
        }
    }

    protected virtual void Start()
    {
        ViewNotifier.RegisterView(this);
    }

    protected virtual void OnDestroy()
    {
        if (_removeView != null)
            _removeView(this);
    }

}
